package com.study.s01.simplefactory;

public class MainClass {
	
	public static void main(String args[]) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
		
//		//实例化，用到了多态
//		Fruit apple = new Apple();
//		Fruit banana = new Banana();

		//实例化
//		Fruit apple = new FruitFactory().getApple();
//		Fruit banana = new FruitFactory().getBanana();
		
//		Fruit apple = FruitFactory.getApple();
//		Fruit banana = FruitFactory.getBanana();
		
		Fruit apple = FruitFactory.getFruit("apple");
		Fruit banana = FruitFactory.getFruit("banana");
		
		apple.get();
		banana.get();
		
		Fruit apple2 = FruitFactory.getFruit2("Apple");
		Fruit banana2 = FruitFactory.getFruit2("Banana");
		
		apple2.get();
		banana2.get();
		
		
	}
}
